Typical HAL GFXMMU use cases for migration ¶
This section provides information about the applicable HAL GFXMMU architecture use cases.
Use case: GFXMMU configuration ¶
This use case shows how to initialize the GFXMMU, configure the LUT lines, and optionally enable interrupt handling as well as cache/prefetch features (device dependent).
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
GFXMMU_HandleTypeDef GfxmmuHandle = {
.Instance = GFXMMU;
.Init.BlocksPerLine =
GFXMMU_192BLOCKS;
.Init.DefaultValue =
0xAAAAAAAA;
.Init.Buffers.Buf0Address = 0x24000000;
.Init.Buffers.Buf1Address = 0;
.Init.Buffers.Buf2Address = 0;
.Init.Buffers.Buf3Address = 0;
.Init.CachePrefetch.Activation = ENABLE;
.Init.CachePrefetch.CacheLock =
GFXMMU_CACHE_LOCK_ENABLE;
.Init.CachePrefetch.CacheLockBuffer =
GFXMMU_CACHE_LOCK_BUFFER0;
.Init.CachePrefetch.CacheForce =
GFXMMU_CACHE_FORCE_ENABLE;
.Init.CachePrefetch.OutterBufferability =
GFXMMU_OUTTER_BUFFERABILITY_DISABLE;
.Init.CachePrefetch.OutterCachability =
GFXMMU_OUTTER_CACHABILITY_DISABLE;
.Init.CachePrefetch.Prefetch =
GFXMMU_PREFETCH_ENABLE;
.Init.Interrupts.Activation = DISABLE;
/* Optional : interrupt */
.Init.Interrupts.Activation = ENABLE;
.Init.Interrupts.UsedInterrupts =
GFXMMU_BUFFER0_OVERFLOW_IT;
};
/* Initialize GFXMMU */
HAL_GFXMMU_Init(&GfxmmuHandle);
/* Optional : interrupt */
/* configure the global interrupt */
HAL_GFXMMU_IRQHandler(&hgfxmmu);
/* Configure the LUT */
HAL_GFXMMU_ConfigLut(&GfxmmuHandle,
0,
100,
(uint32_t) lut_32bpp_20x20);
/* Configure register callback */
HAL_GFXMMU_RegisterErrorCallback(&hgfxmmu,
GFXMMU_ErrorCallback);
/* Configure the force flush and invalidate cache */
HAL_GFXMMU_ConfigForceCache(&GfxmmuHandle,
(GFXMMU_CACHE_FORCE_FLUSH
| GFXMMU_CACHE_FORCE_INVALIDATE));
|
hal_gfxmmu_handle_t hgfxmmu;
hal_gfxmmu_config_t p_globalconfig ={
.blocks_per_line =
HAL_GFXMMU_BLOCK_PER_LINE_192;
}:
hal_gfxmmu_cache_config_t p_config_cache = {
.outer_bufferability =
HAL_GFXMMU_OUTER_BUFFERABILITY_DISABLE;
.outer_cachability =
HAL_GFXMMU_OUTER_CACHABILITY_DISABLE;
};
/* Initialize GFXMMU */
HAL_GFXMMU_Init(&hgfxmmu, HAL_GFXMMU);
/* Optional : interrupt */
/* Enable interrupt */
HAL_GFXMMU_EnableIT(&hgfxmmu,HAL_GFXMMU_IT_BUFF0_OVERFLOW);
/* configure the global interrupt */
HAL_GFXMMU_IRQHandler(&hgfxmmu);
/* Configure the block size */
HAL_GFXMMU_SetConfig(&hgfxmmu, &p_globalconfig);
/* Set the default value */
HAL_GFXMMU_SetDefaultReturnVal(&hgfxmmu,0xAAAAAAAA);
/* Set the physical buffer address */
HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu,
HAL_GFXMMU_BUFF_0,
0x24000000);
/* Configure the LUT */
hal_gfxmmu_lut_config_t p_config;
p_config.first_line = 0;
p_config.lut_size_lines = 100;
p_config.lut = lut_32bpp_20x20;
HAL_GFXMMU_SetLUT(&hgfxmmu, &p_config);
/* Configure register callback */
HAL_GFXMMU_RegisterErrorCallback(&hgfxmmu,
GFXMMU_ErrorCallback);
/* Configure the cache mechanisme */
HAL_GFXMMU_SetConfigCache(&hgfxmmu, &p_config_cache);
HAL_GFXMMU_EnableCache(&hgfxmmu);
HAL_GFXMMU_EnableCacheLockBuff(&hgfxmmu,HAL_GFXMMU_BUFF_0);
HAL_GFXMMU_EnableForceCache(&hgfxmmu);
/* Force flush and invalidate cache */
HAL_GFXMMU_CleanInvalidateCache(&hgfxmmu);
|
Key changes ¶
HAL2 separates the initialization sequence into explicit configuration steps (global configuration, default return value, physical buffer address, and LUT setup).
HAL2 uses
HAL_GFXMMU_EnableIT()to enable GFXMMU interrupts, while HAL1 relies on configuration through the init structure.Cache/prefetch configuration is explicit in HAL2 (for supported devices) through dedicated cache APIs.

